【报错】HuggingFace Transformers connection issue

您所在的位置:网站首页 huggingface bert model 【报错】HuggingFace Transformers connection issue

【报错】HuggingFace Transformers connection issue

2022-12-07 22:20| 来源: 网络整理| 查看: 265

验证pytorch是否为GPU版本

x420981611: (wzh4pytorch) C:\Windows\system32>python Python 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:29:51) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import torch >>> torch.cuda.is_available() ## 输出应该是True True >>> >>> t=torch.nn.Linear(3,3) >>> t.to("cuda:0") Linear(in_features=3, out_features=3, bias=True) >>> >>> input=torch.randn((3,3)).requires_grad_().to("cuda:0") >>> output=t(input) >>> >>> loss=torch.sum(output) >>> torch.autograd.grad(loss,input,retain_graph=True) ## 输出应该是一个gpu上的梯度矩阵 (tensor([[ 0.2812, 0.3565, -0.3112], [ 0.2812, 0.3565, -0.3112], [ 0.2812, 0.3565, -0.3112]], device='cuda:0'),) >>> loss.backward() >>> ^Z (wzh4pytorch) C:\Windows\system32>nvidia-smi Sun Oct 30 07:14:45 2022 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 526.47 Driver Version: 526.47 CUDA Version: 12.0 | |-------------------------------+-



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3